<html>
<head><meta charset="utf-8"><title>fine-grained optimization attributes · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/fine-grained.20optimization.20attributes.html">fine-grained optimization attributes</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="159060567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/fine-grained%20optimization%20attributes/near/159060567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/fine-grained.20optimization.20attributes.html#159060567">(Feb 21 2019 at 11:35)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="123586">@nagisa</span> , while looking over <a href="https://github.com/rust-lang/rust/issues/53823" target="_blank" title="https://github.com/rust-lang/rust/issues/53823">#53823</a>, I had the following potentially very-terrible idea: Have we considered generalizing <a href="https://github.com/rust-lang/rfcs/pull/2412" target="_blank" title="https://github.com/rust-lang/rfcs/pull/2412">RFC 2412</a> ("The optimize attribute"), implemented by PR <a href="https://github.com/rust-lang/rust/issues/55641" target="_blank" title="https://github.com/rust-lang/rust/issues/55641">#55641</a>, to allow one to even toggle individual llvm-args? (In the case of <a href="https://github.com/rust-lang/rust/issues/53823" target="_blank" title="https://github.com/rust-lang/rust/issues/53823">#53823</a>, the motivation would be to toggle <code>llvm-args=-x86-cmov-converter=false</code> just on the <code>fn binary_search</code> methods.)</p>



<a name="159066213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/fine-grained%20optimization%20attributes/near/159066213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/fine-grained.20optimization.20attributes.html#159066213">(Feb 21 2019 at 13:17)</a>:</h4>
<p>Seems problematic to acknowledge the existence of LLVM in the language itself...</p>



<a name="159066244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/fine-grained%20optimization%20attributes/near/159066244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/fine-grained.20optimization.20attributes.html#159066244">(Feb 21 2019 at 13:17)</a>:</h4>
<p>if you can phrase it in backend-neutral terms that might be more workable</p>



<a name="159066324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/fine-grained%20optimization%20attributes/near/159066324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/fine-grained.20optimization.20attributes.html#159066324">(Feb 21 2019 at 13:18)</a>:</h4>
<p>for the standard library such fine-grained optimizations could be done with <code>#[rustc_optimize(...)]</code> as a forever-unstable mechanism</p>



<a name="159080387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/fine-grained%20optimization%20attributes/near/159080387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/fine-grained.20optimization.20attributes.html#159080387">(Feb 21 2019 at 16:11)</a>:</h4>
<p>LLVM command line arguments unfortunately can't be toggled on such a fine grained level. For a few things there might be corresponding function attributes we could use, but usually it's just global state. To change it for one function, you'd need to break out that function into a separate compilation unit and run the relevant parts of the pipeline (which for cmov conversion includes the codegen pipeline) and stitch the results together (in this case, that means linking machine code).</p>



<a name="159082649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/fine-grained%20optimization%20attributes/near/159082649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/fine-grained.20optimization.20attributes.html#159082649">(Feb 21 2019 at 16:34)</a>:</h4>
<p>we haven’t.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>